﻿/***************************************************************************
 //* Foxit Software Inc.
 //* Copyright(C) 2005-2012, all rights reserved.
 //*
 //* The following code is copyrighted and contains proprietary information
 //* and trade secrets of Foxit Software Inc.                                                      *
 ***************************************************************************/
/**
 * PDF 签名 类
 */
define(function (require, exports, module) {
    /**
     * Enum for supported signature type.
     * @enum
     * @private
     */
	WebPDF.PDFData.SignatureType = {
			Text:"text",
			Img:"img"
	};
	
	WebPDF.PDFData.BaseSignature = {
			Date:"date",
			Text:"text"
	};

	WebPDF.PDFData.SignatureDataJSONFormat = {
	        type:"type",
	        id:"id",
			filePath:"path",
			fontColor:"fc",
			fontSize:"fs",
			fontName:"fn",
			bold:"b",
			italic:"i",
			underLine:"ul",
			width:"w",
			height:"h",
			signatureText:"txt"
	};
	
	var SignatureDataJSONFormat = WebPDF.PDFData.SignatureDataJSONFormat;
    /**
     * @param jsonData
     * @constructor
     * @private
     */
    WebPDF.PDFData.PDFSignature = function (jsonData) {
    	if(jsonData){
    		this.signature = jsonData;
    	}else{
    		this.signature = {};
    	}
    };
    
    WebPDF.PDFData.PDFSignature.prototype = {
    		/**
             * Get signature data in JSON format
             * @returns {*}
             */
            getSignatureJSONData: function () {
                return this.signature;
            },
            /**
             * Whether the bold of font.
             * @returns {boolean} return true if font is bold, otherwise return false.
             */
    		getBold:function(){
    			return this.signature[SignatureDataJSONFormat.bold];
    		},
    		/**
    		 * Set the font bold tag
    		 * @param {boolean} bold True is bold, false otherwise.
    		 */
    		setBold:function(bBold){
    			this.signature[SignatureDataJSONFormat.bold] = bBold;
    		},
    		/**
    		 * Whether the italic of font.
    		 * @returns {boolean} return true if font is italic, otherwise return false.
    		 */
    		getItalic:function(){
    			return this.signature[SignatureDataJSONFormat.italic];
    		},
    		/**
    		 * Set the font italic tag
    		 * @param {boolean} italic True is italic, false otherwise.
    		 */
    		setItalic:function(bItalic){
    			this.signature[SignatureDataJSONFormat.italic] = bItalic;
    		},
    		/**
    		 * Whether the underline  of font.
    		 * @returns {boolean} return true if font is underline, otherwise return false.
    		 */
    		getUnderLine:function(){
    			return this.signature[SignatureDataJSONFormat.underLine];
    		},
    		/**
    		 * Set the font underLine tag
    		 * @param {boolean} italic True is underLine, false otherwise.
    		 */
    		setUnderLine:function(bUnderLine){
    			this.signature[SignatureDataJSONFormat.underLine] = bUnderLine;
    		},
    		/**
             * Get type of signature
             * @returns {WebPDF.PDFData.SignatureType}
             */
    		getType:function(){
    			return this.signature[SignatureDataJSONFormat.type];
    		},
    		/**
    		 * Set type of signature
    		 * @param {WebPDF.PDFData.SignatureType} type type of signature
    		 */
    		setType:function(type){
    			this.signature[SignatureDataJSONFormat.type] = type;
    		},
    		/**
             * Get id of signature
             * @returns {String} return id of signature
             */
    		getId:function(){
    			return this.signature[SignatureDataJSONFormat.id];
    		},
    		/**
    		 * Set id of signature
    		 * @param {String} id id of signature
    		 */
    		setId:function(id){
    			this.signature[SignatureDataJSONFormat.id] = id;
    		},
    		/**
    		 * Get text content of signature
    		 * @returns {String} text content of signature
    		 */
    		getSignatureText:function(){
    			return this.signature[SignatureDataJSONFormat.signatureText];
    		},
    		/**
    		 * Set text content of signature
    		 * @param  {String} signatureText text content of signature
    		 */
    		setSignatureText:function(signatureText){
    			this.signature[SignatureDataJSONFormat.signatureText] = signatureText;
    		},
    		/**
    		 * Get img path or data of signature
    		 * @returns {String} img path or data of signature
    		 */
    		getFilePath:function(){
    			return this.signature[SignatureDataJSONFormat.filePath];
    		},
    		/**
    		 * Set img path or data of signature
    		 * @param {String} img path or data of signature
    		 */
    		setFilePath:function(filePath){
    			this.signature[SignatureDataJSONFormat.filePath] = filePath;
    		},
    		/**
             * Set color of font
             * @param {String} fontColor color of font, the format is like #ffffff
             */
    		setFontColor:function(fontColor){
    			this.signature[SignatureDataJSONFormat.fontColor] = fontColor;
    		},
    		/**
             * Get color of font
             * @returns {String} color of font, the format is like #ffffff
             */
    		getFontColor:function(){
    			return this.signature[SignatureDataJSONFormat.fontColor];
    		},
    		/**
             * Get size of font
             * @returns {Number} size of font
             */
    		getFontSize:function(){
    			return this.signature[SignatureDataJSONFormat.fontSize];
    		},
    		/**
             * Set size of font
             * @param {Number} fontSize size of font
             */
    		setFontSize:function(fontSize){
    			this.signature[SignatureDataJSONFormat.fontSize] = fontSize;
    		},
    		/**
             * Get the font name
             * @returns {String} the font name
             */
    		getFontName:function(){
    			return this.signature[SignatureDataJSONFormat.fontName];
    		},
    		/**
    		 *  Get the font name
    		 * @param {String} fontName the font name
    		 */
    		setFontName:function(fontName){
    			this.signature[SignatureDataJSONFormat.fontName] = fontName;
    		},
    		/**
    		 * Get width of signature.
    		 * @returns {Number} width of signature.
    		 */
    		getWidth:function(){
    			return this.signature[SignatureDataJSONFormat.width];
    		},
    		/**
    		 * Set width of signature.
    		 * @param {Number} width width of signature.
    		 */
    		setWidth:function(width){
    			this.signature[SignatureDataJSONFormat.width] = width;
    		},
    		/**
    		 * Get height of signature.
    		 * @returns {Number} height of signature.
    		 */
    		getHeight:function(){
    			return this.signature[SignatureDataJSONFormat.height];
    		},
    		/**
    		 * Set width of signature.
    		 * @param {Number} width width of signature.
    		 */
    		setHeight:function(height){
    			this.signature[SignatureDataJSONFormat.height] = height;
    		}
    };
   
    return WebPDF.PDFData.PDFSignature;
});